<?php namespace Home\Model;
use Hdphp\Model\Model;
//注册模型
class Reg extends Model{
	protected $table = "user";
	protected $validate = array(
		array('uname','required','用户名不能为空',3,3),
		array('upassword','required','密码不能为空',3,3)
	);
	
	public function regUser(){
	    if(!$this->create()) return false;
		$userData = array(
			'uname' => Q('post.uname'),
			'upassword' => md5(Q('post.upassword'))
		);
		$this->add($userData);
		return true;
	}
}

 ?>